<!--#INCLUDE FILE="conn.asp"-->
<!-- #include file="aFunction_charCode.asp" -->

<%
Call tslt_useridentity12_error_end()

dim boardid
boardid=request("boardid")
if boardid<>"" then
       boardid=cint(boardid)
end if
%>
<html>
<head>
<title></title>
<link href=../style/<%=session("tslt_stylefolder")%>/admin.css rel="stylesheet" type="text/css">
<SCRIPT for=boardsort event=onblur language=javaScript>
        if( isNaN(document.updatefrm.boardsort.value)) {
             alert("ݱ֣");
             document.updatefrm.boardsort.value="";
             document.updatefrm.boardsort.focus();
             return false;
       }
</SCRIPT>

<SCRIPT language="JavaScript">
        function set_onchange() {
             if(updatefrm.act.selectedIndex == 1){
                 updatefrm.Bchk.style.display="inline";
                 updatefrm.BText.style.display="inline";
                 updatefrm.BText.value="ֻ֤аԱ֤ԱԽ롣ѡиѡ򣬿Ϊרʹá";
             }
             else if(updatefrm.act.selectedIndex == 2){
                 updatefrm.Bchk.style.display="none";
                 updatefrm.BText.style.display="inline";
                 updatefrm.BText.value="ֻֻйԱԷӣڷվҪϢ";
             }
             else{
                 updatefrm.Bchk.style.display="none";
                 updatefrm.BText.style.display="none";
                 updatefrm.BText.value="";
             }
        }
</SCRIPT>

</head>
<body bgcolor=#aaaac4>
<center>
<br>
<table><tr><td class="font2"></td></tr></table>
<br>
<table width="70%" border="0" cellpadding="0" cellspacing="0">
             <tr>
                   <td align="left" valign="middle" bgcolor="#f7f6f6">
                         <img src="../images/tushan2.gif" align="middle" width=100 height=50>
                         <font size=2><b><a class=a1 href="bm.asp">̳</a>&nbsp;>>&nbsp;޸</b></font>
                   </td>
             </tr> 
</table>

<form name="updatefrm" action="bm_modify.asp" method="post">
<table border="0" cellspacing="0" cellpadding="0"> 
<%
      dim rs
      dim sql
      sql="select * from board where boardid="&boardid
      set rs=conn.execute(sql)
            if not rs.eof then
%>
                  <tr>
                         <td colspan=2 align="center">
                                <%if rs("boardimg")="" then%>
                                         <font size=4 face="" color=<%=rs("wordcolor")%>><%=rs("boardname")%></font>
                                 <%else%>
                                          <img src="../<%=rs("boardimg")%>" width="160" height="32">
                                 <%end if%>
                          </td>
                   </tr>
                   <tr> <td width="140" align="right">ͼƬַ</td><td><input type="text" name="boardimg" value="<%=rs("boardimg")%>"></td></tr> 
                   <tr> <td width="140" align="right">֣</td><td><input type="text" name="boardname" value="<%=rs("boardname")%>"></td></tr> 
                   <tr> <td width="140" align="right">ܣ</td><td><textarea name="boarddetail" cols="25" rows="4"><%=rs("boarddetail")%></textarea></td></tr> 
                   <tr> <td wdith="140" align="right">ݣ</td><td><input type="text" size="3" maxlength="3" name="boardsort" value="<%=rs("boardsort")%>"></td></tr> 
                   <tr> <td wdith="140" align="right"></td><td><%call SelectCommunityName(rs("Communityid"))%></td></tr>
                   <tr> <td wdith="140" align="right">ͣ</td>
				        <td>
						     <select name=act LANGUAGE=javascript onchange="return set_onchange()">
                                   <option value="0"></option>
                                   <%If rs("autSel")=True Or rs("authentication")=True Then%>
                                        <option value="1" selected>֤</option>
                                        <option value="2">ֻ</option>
                                        <option value="3">ذ</option>
                                   <%ElseIf rs("boardreadonly")=True Then%>
                                        <option value="1">֤</option>
                                        <option value="2" selected>ֻ</option>
                                        <option value="3">ذ</option>
                                   <%ElseIf rs("boardhidden")=True Then%>
                                        <option value="1">֤</option>
                                        <option value="2">ֻ</option>
                                        <option value="3" selected>ذ</option>
                                   <%Else%>
                                        <option value="1">֤</option>
                                        <option value="2">ֻ</option>
                                        <option value="3">ذ</option>
                                   <%End If %>
                             </select>
                             <%If rs("autSel")=True Or rs("authentication")=True Then%>
                                  <input type="checkbox" name="Bchk" <%if rs("autSel")=true then%>checked<%end if%> onclick="alert('ѡиѡֻйԱͰܽð飬Ϊרʹá');">
                             <%Else%>
                                  <input type="checkbox" name="Bchk" style="display:none" onclick="alert('ѡиѡֻйԱͰܽð飬Ϊרʹá');">
                             <%End If%>

                             <%If rs("autSel")=True Or rs("authentication")=True Then%>
                                    <input type="text" name="BText" value="ֻ֤аԱ֤ԱԽ롣ѡиѡ򣬿Ϊרʹá" size="69" disabled>
                             <%ElseIf rs("boardreadonly")=True Then%>
                                    <input type="text" name="BText" value="ֻֻйԱԷӣڷվҪϢ" size="48" disabled>
                             <%Else%>
                                    <input type="text" name="BText" value="" size="69" style="display:none" disabled>
                             <%End If%>

						</td>
				   </tr>

				   <tr> 
                          <td></td>
                          <td align="left">
                                   <input type="hidden" name="isok" value="yes"> 
                                   <input type="hidden" name="boardid" value="<%=rs("boardid")%>">
                                   <input type="submit" name="submitbtn" value=" ޸ ">   
                                   <input type="button" name="backbtn" value=" ȡ " onClick="location.href='bm.asp';"> 
                           </td>
                    </tr>
<%
            end if
      rs.close
      set rs=nothing
%>
</table>
</form>
</center>
</body>
</html>

<%
dim isok
isok=request.form("isok")
if isok="yes" then
        updatebd boardid
end if

Call conn_Nothing()

sub updatebd(aaa)
        dim boardname,boarddetail,boardimg,boardsort,HiddenSelect
        boardname=request.form("boardname")
        boarddetail=request.form("boarddetail")
        boardimg=request.form("boardimg")
        boardsort=request.form("boardsort")
        HiddenSelect=request.form("HiddenSelect")

        dim sql
        dim act
        act=request.form("act")
        If act=0 Then
            sql="update board set boardname='"&boardname&"', boardsort="&boardsort&",boardimg='"&boardimg&"',boarddetail='"&boarddetail&"',Communityid="&HiddenSelect&",authentication=false,boardreadonly=false,boardhidden=false,autSel=false where boardid="&aaa
		ElseIf act=1 Then
		    sql="update board set boardname='"&boardname&"',boardsort="&boardsort&",boardimg='"&boardimg&"',boarddetail='"&boarddetail&"',Communityid="&HiddenSelect&",authentication=true where boardid="&aaa
		ElseIf act=2 Then
		    sql="update board set boardname='"&boardname&"',boardsort="&boardsort&",boardimg='"&boardimg&"',boarddetail='"&boarddetail&"',Communityid="&HiddenSelect&",boardreadonly=true where boardid="&aaa
		ElseIf act=3 Then
		    sql="update board set boardname='"&boardname&"',boardsort="&boardsort&",boardimg='"&boardimg&"',boarddetail='"&boarddetail&"',Communityid="&HiddenSelect&",boardhidden=true where boardid="&aaa
		End If 
		conn.execute(sql)

        dim Bchk
        Bchk=request.form("Bchk")
        If Bchk="on" Then
		    sql="update board set boardname='"&boardname&"',boardsort="&boardsort&",boardimg='"&boardimg&"',boarddetail='"&boarddetail&"',Communityid="&HiddenSelect&",autSel=true where boardid="&aaa
        Else
		    sql="update board set boardname='"&boardname&"',boardsort="&boardsort&",boardimg='"&boardimg&"',boarddetail='"&boarddetail&"',Communityid="&HiddenSelect&",autSel=false where boardid="&aaa
		End If 
		conn.execute(sql)
        Response.write"<SCRIPT language=Javascript>passwords(promptInfo_bm_modify(0))</SCRIPT>"
        Response.end
end sub 

Function Communityname(aaa)
           dim SQL,RS
           SQL = "SELECT * FROM community where cstr(id)='" & aaa &"'"
           set RS=conn.execute(SQL)
                 do while not RS.eof
                       Communityname= RS("CommunityName")
                       RS.movenext
                 loop
           RS.close
           set RS=nothing
End Function

sub SelectCommunityName(aaa)
        response.write"<select size=1 width=10 name=HiddenSelect>"
              response.write"<option value='"&aaa&"'>"&Communityname(aaa) &"</option>"
              dim rs
              set rs=conn.execute("select CommunityName,id from community order by CommunitySort ASC") 
                    do while not rs.eof
                          response.write"<option value='"&rs("id")&"'>"&rs("CommunityName")&"</option>"
                          rs.movenext 
                    loop
              rs.close
              set rs=nothing
        response.write"</select>"
end sub
%>

